<?php
function smarty_block_dynamictable($params, $content, &$smarty, $open) {
    if (!$open) {
        $width = 150;
        $height = 70;
        $subtitle = "";
        $title = "";
        $name = "";
        $buttontitle = "Add more";
        $bottomtext = "";
        $headers = array();
        foreach ($params as $key=>$value) {
            if ($key == "width") {
                $width = $value;
            } else if ($key == "height") {
                $height = $value;
            } else if ($key == "name") {
                $name = $value;
            } else if ($key == "buttontitle") {
                $buttontitle = $value;
            } else if ($key == "headers") {
                $headers = explode(",", $value);
            } else if ($key == "title") {
                $title = $value;
            } else if ($key == "bottomtext") {
                $bottomtext = $value;
            } else if ($key == "subtitle") {
                $subtitle = $value;
            }
        }
        $smarty->assign("width", $width);
        $smarty->assign("height", $height);
        $smarty->assign("name", $name);
        $smarty->assign("content", $content);
        $smarty->assign("title", $title);
        $smarty->assign("buttontitle", $buttontitle);
        $smarty->assign("bottomtext", $bottomtext);
        $smarty->assign("headers", $headers);
        $smarty->assign("subtitle", $subtitle);

        return $smarty->fetch("site/plugins/dynamictable.tpl");
    }
}

?>
